/*
 ============================================================================
 文件名     : GameAudioPlayer.h
 描述      : 声明音频播放器类
 ============================================================================
 */

#ifndef GAME_AUDIO_PLAYER_H_
#define GAME_AUDIO_PLAYER_H_

// 引用
#include <mdaAudioSamplePlayer.h>
#include "GameObserver.h"

// 类声明
/*
 * CGameAudioPlayer类
 */
class CGameAudioPlayer : public CBase, 
                         public MMdaAudioPlayerCallback,
                         public MGameObserver
	{
	
public:
	/**
	 * NewL
	 * 构造函数
	 */
	static CGameAudioPlayer* NewL();
	
	/**
	 * ~CGameAudioPlayer
	 * 析构函数
	 */
	~CGameAudioPlayer();

public: // from MMdaAudioPlayerCallback
	void MapcInitComplete(TInt aError, 
			const TTimeIntervalMicroSeconds& aDuration);
	void MapcPlayComplete(TInt aError);
	
public:
	/**
	 * Play
	 * 播放声音
	 */
	void Play();
	
public: // from MGameObserver
    void GameChanged( CEngine* aGame );
    void GameOver( CEngine* aGame );
    void GamePaused( CEngine* aGame );
    void BallHitsLine( CEngine* aGame );
	
private:
	
	/**
	 * NewL
	 * 构造函数
	 */	
    CGameAudioPlayer();
    
	/**
	 * NewL
	 * 两段构造函数
	 */    
	void ConstructL();

private:
	// 提供播放功能的成员
	CMdaAudioPlayerUtility* iPlayer;
	// 播放器状态
	TInt iState;
	
	// 状态值
	enum SState
		{
		ENotReady,
		EReady,
		EPlaying
		};
	};

#endif /*GAME_AUDIO_PLAYER_H_*/
